import http from './interface.js'
//设置请求结束后拦截器
http.interceptor.response = (response) => {
	response = Object.assign(response , response.data );
	console.log('response',response);
	return response;
}
// 请求后端把所有码表内容存起来。

// 用户注册
export const userRegister = (data) => {
	return http.request({
		url: '/login/userRegister',
		method: 'POST',
		data,
	})
}
// 用户注册
export const qqUserRegister = (data) => {
	return http.request({
		url: '/login/qqUserRegister',
		method: 'POST',
		data,
	})
}
// 用户登录
export const userLogin = (data) => {
	return http.request({
		url: '/login/userLogin',
		method: 'GET',
		data,
	})
}

export const userSeekHelp = (data) => {
	return http.request({
		url: '/help/userSeekHelp',
		method: 'GET',
		// showToast : {
		// 	title : '系统正在为您匹配好友'
		// },
		data,
	})
}
export const findGlobalcodelist = (data) => {
	return http.request({
		url: '/globalcode/findGlobalcodelist',
		method: 'GET',
		data,
	})
}
export const addFriend = (data) => {
	return http.request({
		url: '/login/addFriend',
		method: 'GET',
		data,
	})
}
//查看用户信息
export const userMessage = (data) => {
	return http.request({
		url: '/login/userMessage',
		method: 'GET',
		data,
	})
}
//编辑用户信息
export const updateUserMessage = (data) => {
	return http.request({
		url: '/login/updateUserMessage',
		method: 'GET',
		data,
	})
}
//查看用户信息
export const getUserInfoById = (data) => {
	return http.request({
		url: '/login/getUserInfoById',
		method: 'GET',
		data,
	})
}
//论坛贴吧列表
export const articleList = (data) => {
	return http.request({
		url: '/article/articleList',
		method: 'GET',
		data,
	})
}
//论坛贴详情
export const articleDetails = (data) => {
	return http.request({
		url: '/article/articleDetails',
		method: 'GET',
		data,
	})
}
//发帖
export const articleUplod = (data) => {
	return http.request({
		url: '/article/articleUplod',
		method: 'POST',
		data,
	})
}
//点赞数
export const articleLoveCount = (data) => {
	return http.request({
		url: '/article/articleLoveCount',
		method: 'POST',
		data,
	})
}
//点赞||取消点赞
export const articleLove = (data) => {
	return http.request({
		url: '/article/articleLove',
		method: 'POST',
		data,
	})
}

// 默认全部导出  import api from '@/common/vmeitime-http/'
export default {
	articleLove,
	articleLoveCount,
	articleUplod,
	articleDetails,
	articleList,
	getUserInfoById,
	updateUserMessage,
	userRegister,
	qqUserRegister,
	userLogin,
	userMessage,
	userSeekHelp,
	findGlobalcodelist,
	addFriend
}
